/*
 * @Date: 2021-09-09 15:29:47
 * @Author: Acckno1
 * @LastEditTime: 2021-09-09 15:58:09
 * @Description: 
 */
#include <iostream>
#include <cstring>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <set>
#include <bitset>
#include <utility>
using namespace std;

#define mm(a, n) memset(a, n, sizeof a)
#define mk(a, b) make_pair(a, b)

const double eps = 1e-6;
const int INF = 0x3f3f3f3f;

typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int, int> PII;
typedef pair<double, double> PDD;
typedef pair<LL, LL> PLL;
typedef pair<int, LL> PIL;

inline void quickread() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
}

const int N = 1e4 + 10;

struct Record{
    string name;
    int Gp, Gm = -1, Gf = -1, total;
    
    bool operator< (const Record & r1) const {
        if (total != r1.total) 
            return total > r1.total;
        return name < r1.name;
    }
}r[N];

int n, m, k;
int idx = 0;
unordered_map<string, int> stu;

inline void solution() {
    cin >> n >> m >> k;
    for (int i = 0; i < n; i ++ ) {
        string name;
        cin >> name;
        if (!stu.count(name)) {
            r[idx].name = name;
            stu[name] = idx ++ ;
        } 
        cin >> r[stu[name]].Gp;
    }
    for (int i = 0; i < m; i ++ ) {
        string name;
        cin >> name;
        if (!stu.count(name)) {
            r[idx].name = name;
            stu[name] = idx ++ ;
        } 
        cin >> r[stu[name]].Gm;
    }
    for (int i = 0; i < k; i ++ ) {
        string name;
        cin >> name;
        if (!stu.count(name)) {
            r[idx].name = name;
            stu[name] = idx ++ ;
        } 
        cin >> r[stu[name]].Gf;
    }

    for (int i = 0; i < idx; i ++ ) {
        double t = r[i].Gm * 0.4 + r[i].Gf * 0.6 - 0.5;
        r[i].total = r[i].Gm > r[i].Gf ? ceil(t) : r[i].Gf;
        // if (r[i].Gm == -INF) r[i].Gm = -1;
        // if (r[i].Gf == -INF) r[i].Gf = -1;
    }
    
    sort(r, r + idx);
    int i = 0;
    while (i < idx) {
        if (r[i].total < 60) break;
        if (r[i].Gp < 200) {i ++ ;continue;}
        cout << r[i].name << " " << r[i].Gp << " " << r[i].Gm << " " << r[i].Gf << " " << r[i].total << endl;
        i ++ ;
    }
}

int main() {
    freopen("input.txt", "r", stdin);
    quickread();
    solution();
    return 0;
}